package tut.thread.wait.greatEx;

public class Notifier implements Runnable{
	private Message msg;

	public Notifier(Message msg){
		this.msg = msg;
	}

	public void run() {
		String name = Thread.currentThread().getName();
		System.out.println(name + " started");
		try {
			Thread.sleep(1000);
			synchronized (msg) {
				msg.setMsg("Notifier work done");
				//msg.notify();
				msg.notifyAll();
			}
		} catch (InterruptedException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}
}
